#@layout()

#define script()
<script>
    $('.del-action').on('click', function () {
        if (confirm('确定要删除该标签吗？删除后不可恢复')) {
            var id = $(this).attr("data-id");
            ajaxGet("#(CPATH)/admin/article/doCategoryDel/" + id)
        }
    });


</script>

#end

#define content()
    <section class="content-header">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-6">

                    <div class="row mb-2">
                        <div class="col-sm-12">
                            <h1>
                                文章标签
                                <small data-toggle="tooltip" title="" data-placement="right"
                                       data-trigger="hover"><i class="nav-icon far fa-question-circle"></i></small>
                                <small> 首页 / 文章 / 文章标签</small>
                            </h1>
                        </div>
                    </div>
                </div>
            </div>

        </div><!-- /.container-fluid -->
    </section>

    <section class="content">

        <div class="row">
            <div class="col-lg-5">
                <div class="card card-outline card-primary">

                    <!-- /.card-header -->
                    <!-- form start -->
                    <form class=" form-setting autoAjaxSubmit" autocomplete="off"
                          action="#(CPATH)/admin/article/doTagSave"
                          data-ok-href="#(CPATH)/admin/article/tag"
                          data-ok-message="文章标签保存成功"
                          method="post">
                        <input type="hidden" name="category.id" value="#(category.id ??)">
                        <input type="hidden" name="category.type" value="tag">
                        <div class="card-body">
                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label"><span class="text-danger mr-2">*</span> 名称 </label>

                                <div class="col-sm-9">
                                    <input type="input" class="form-control" placeholder="取个适合的标签名称..." required
                                           value="#(category.title ??)" name="category.title">
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">内容</label>
                                <div class="col-sm-9">
                                    <textarea rows="3" class="form-control" placeholder="..."
                                              name="category.content">#(category.content ??)</textarea>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">摘要</label>
                                <div class="col-sm-9">
                                    <textarea rows="3" class="form-control" placeholder="..."
                                              name="category.summary">#(category.summary ??)</textarea>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">排序</label>
                                <div class="col-sm-9">
                                    <input type="input" class="form-control" placeholder="此标签排序的序号"
                                           value="#(category.order_number ??)"
                                           name="category.order_number">
                                    <p class="text-muted"> 其显示方式决定在模板的读取方式。 </p>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">模板</label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="category.style">
                                        <option value="">默认（artlist.html）</option>
                                        #for(style : styles)
                                        <option value="#(style)" #selectedIf(category && category.style== style)>
                                            artlist_#(style).html
                                        </option>
                                        #end
                                    </select>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">显示到菜单</label>
                                <div class="col-sm-9">
                                    <input type="checkbox" class="switchery" data-for="displayInMenu"
                                           #checkedIf(isDisplayInMenu)>
                                    <input type="hidden" id="displayInMenu" name="displayInMenu" value="false">
                                </div>
                            </div>


                            <h4 class="form-header">SEO</h4>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">描述</label>

                                <div class="col-sm-9">
                                    <textarea rows="3" class="form-control"
                                              placeholder="此内容会显示在搜索引擎的列表描述上..."
                                              name="category.meta_description">#(category.meta_description ??)</textarea>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">关键字</label>
                                <div class="col-sm-9">
                                    <input type="input" class="form-control" placeholder="多个关键字用逗号隔开"
                                           name="category.meta_keywords" value="#(category.meta_keywords ??)">
                                </div>
                            </div>
                        </div>
                        <!-- /.card-body -->
                        <div class="card-footer">
                            <div class="offset-sm-2 col-sm-10 submit-block">
                                <div class="card-submit">
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </div>
                        <!-- /.card-footer -->
                    </form>
                </div>
            </div>
            <div class="col-lg-7">
                <div class="card card-outline card-primary">



                    <div class="card-body p-0  ">

                        <table class="table table-striped">
                            <tbody>
                            <tr>
                                <th style="width: 40%">名称</th>
                                <th>描述</th>
                                <th>排序</th>
                            </tr>
                            #for(category : page.list)
                            <tr>
                                <td>
                                    <strong>
                                        <a href="#(category.url ??)" target="_blank">
                                            #(category.title)
                                        </a>
                                        （#(category.count ?? 0)）
                                    </strong>
                                    <div class="jp-action-card">
                                        <div class="jp-action-body">
                                            <a href="#(CPATH)/admin/article/tag/#(category.id)">编辑</a> |
                                            <a href="javascript:;" class="del-action red-action"
                                               data-id="#(category.id)">删除</a> |
                                            <a href="#(category.url ??)" class="red-action" target="_blank">查看</a>
                                        </div>
                                    </div>
                                </td>
                                <td>#(category.content ??)</td>
                                <td>#(category.order_number ??)</td>
                            </tr>
                            #else
                            <tr class="nodata"><td colspan="999">暂无数据</td> </tr>
                            #end
                            </tbody>
                        </table>
                    </div>
                    <!-- /.card-body -->
                    <div class="card-footer">
                        <div class="row">
                            <div class="col-sm-12">
                                #@_paginate()
                            </div>
                        </div>
                    </div>
                    <!-- /.card-footer -->
                </div>
                <!-- /.card -->
            </div>
            </div>
    </section>

#end
